import React from 'react';
import {Grid, Toast} from 'antd-mobile';
import Icon from './index';
import {Tool} from '../../utils';

/**
 * Demo
 */
export default class Test extends React.Component {
  render() {
    return (
      <Grid
        data={Icon.types}
        columnNum={5}
        renderItem={(item) => (
          <div style={{padding: '12.5px'}}>
            <div>
              <a onClick={() => this.click(item)}>
                <Icon type={item} color="#F77" size="lg" />
              </a>
            </div>
            {item}
          </div>
        )}
      />
    );
  }

  /**
   * 点击图标
   * @param item
   */
  click(item) {
    let text = `<Icon type="${item}" color="#F77" size="lg"/>`;
    Tool.copyText(text);
    Toast.success(text);
  }
}
